package main

import (
	"log"
	"math/rand"
	"os"
	"runtime"
	"start/app/user/api/app"
	"start/app/user/api/common"
	"start/app/user/api/docs"
	"time"
)

//	@title						system API
//	@version					1.0.0
//	@description				系统级api.
//	@securityDefinitions.apikey	ApiKeyAuth
//	@in							header
//	@name						Authorization
func main() {
	// swagger config
	//docs.SwaggerInfo.Title = "user API"
	//docs.SwaggerInfo.Description = "user api."
	//docs.SwaggerInfo.Version = "1.0"
	//docs.SwaggerInfo.Host = addr
	//docs.SwaggerInfo.Schemes = []string{"http", "https"}
	if common.Config.App.Env == "dev" {
		docs.SwaggerInfo.BasePath = ""
	} else {
		docs.SwaggerInfo.BasePath = "/user-api"
	}

	// 启动服务
	rand.NewSource(time.Now().UnixMicro())
	if 0 == len(os.Getenv("GOMAXPROCS")) {
		runtime.GOMAXPROCS(runtime.NumCPU())
	}

	if err := app.Run(); err != nil {
		log.Printf("server exit %s", err.Error())
	}
}
